package com.example.onlineeducation.utils

import android.content.Context
import android.content.Intent
import android.net.Uri
import android.provider.MediaStore
import java.io.File
import java.io.FileNotFoundException

object ImageLoadUtils {
    /**
     * 通知相册刷新
     */
    fun photoAlbumRefresh(context: Context, fileName: String, filePath: String) {
        try {
            MediaStore.Images.Media.insertImage(context.contentResolver, filePath, fileName, null)
        } catch (e: FileNotFoundException) {
            e.printStackTrace()
        }
        context.sendBroadcast(Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(File(filePath))))
    }

}